/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ccore.constraint.impl;

import ccore.CcorePackage;

import ccore.common.CommonPackage;

import ccore.common.impl.CommonPackageImpl;

import ccore.constraint.CAnd;
import ccore.constraint.CConstraint;
import ccore.constraint.CConstraintExpr;
import ccore.constraint.CEq;
import ccore.constraint.CImp;
import ccore.constraint.CIntCompare;
import ccore.constraint.CLeq;
import ccore.constraint.CLogicConstraint;
import ccore.constraint.CLt;
import ccore.constraint.CNConstraint;
import ccore.constraint.CNeq;
import ccore.constraint.CNot;
import ccore.constraint.COneConstraint;
import ccore.constraint.COr;
import ccore.constraint.CTwoConstraint;
import ccore.constraint.ConstraintFactory;
import ccore.constraint.ConstraintPackage;

import ccore.expression.ExpressionPackage;

import ccore.expression.impl.ExpressionPackageImpl;

import ccore.impl.CcorePackageImpl;

import ccore.instance.InstancePackage;

import ccore.instance.impl.InstancePackageImpl;

import ccore.model.ModelPackage;

import ccore.model.impl.ModelPackageImpl;

import choco.Constraint;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ConstraintPackageImpl extends EPackageImpl implements ConstraintPackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cConstraintExprEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cIntCompareEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cEqEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cNeqEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cLtEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cLeqEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cLogicConstraintEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cAndEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cOrEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cImpEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cNotEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cnConstraintEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cOneConstraintEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cConstraintEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass cTwoConstraintEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EDataType constraintEDataType = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see ccore.constraint.ConstraintPackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private ConstraintPackageImpl() {
		super(eNS_URI, ConstraintFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this
	 * model, and for any others upon which it depends.  Simple
	 * dependencies are satisfied by calling this method on all
	 * dependent packages before doing anything else.  This method drives
	 * initialization for interdependent packages directly, in parallel
	 * with this package, itself.
	 * <p>Of this package and its interdependencies, all packages which
	 * have not yet been registered by their URI values are first created
	 * and registered.  The packages are then initialized in two steps:
	 * meta-model objects for all of the packages are created before any
	 * are initialized, since one package's meta-model objects may refer to
	 * those of another.
	 * <p>Invocation of this method will not affect any packages that have
	 * already been initialized.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static ConstraintPackage init() {
		if (isInited) return (ConstraintPackage)EPackage.Registry.INSTANCE.getEPackage(ConstraintPackage.eNS_URI);

		// Obtain or create and register package
		ConstraintPackageImpl theConstraintPackage = (ConstraintPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof ConstraintPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new ConstraintPackageImpl());

		isInited = true;

		// Obtain or create and register interdependencies
		CcorePackageImpl theCcorePackage = (CcorePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(CcorePackage.eNS_URI) instanceof CcorePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(CcorePackage.eNS_URI) : CcorePackage.eINSTANCE);
		ModelPackageImpl theModelPackage = (ModelPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI) : ModelPackage.eINSTANCE);
		InstancePackageImpl theInstancePackage = (InstancePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(InstancePackage.eNS_URI) instanceof InstancePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(InstancePackage.eNS_URI) : InstancePackage.eINSTANCE);
		ExpressionPackageImpl theExpressionPackage = (ExpressionPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExpressionPackage.eNS_URI) instanceof ExpressionPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExpressionPackage.eNS_URI) : ExpressionPackage.eINSTANCE);
		CommonPackageImpl theCommonPackage = (CommonPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) instanceof CommonPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) : CommonPackage.eINSTANCE);

		// Create package meta-data objects
		theConstraintPackage.createPackageContents();
		theCcorePackage.createPackageContents();
		theModelPackage.createPackageContents();
		theInstancePackage.createPackageContents();
		theExpressionPackage.createPackageContents();
		theCommonPackage.createPackageContents();

		// Initialize created meta-data
		theConstraintPackage.initializePackageContents();
		theCcorePackage.initializePackageContents();
		theModelPackage.initializePackageContents();
		theInstancePackage.initializePackageContents();
		theExpressionPackage.initializePackageContents();
		theCommonPackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theConstraintPackage.freeze();

		return theConstraintPackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCConstraintExpr() {
		return cConstraintExprEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCIntCompare() {
		return cIntCompareEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getCIntCompare_Parameters() {
		return (EReference)cIntCompareEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCEq() {
		return cEqEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCNeq() {
		return cNeqEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCLt() {
		return cLtEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCLeq() {
		return cLeqEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCLogicConstraint() {
		return cLogicConstraintEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCAnd() {
		return cAndEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCOr() {
		return cOrEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCImp() {
		return cImpEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCNot() {
		return cNotEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCNConstraint() {
		return cnConstraintEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getCNConstraint_Constraints() {
		return (EReference)cnConstraintEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCOneConstraint() {
		return cOneConstraintEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getCOneConstraint_Constraint() {
		return (EReference)cOneConstraintEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCConstraint() {
		return cConstraintEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getCConstraint_Comment() {
		return (EAttribute)cConstraintEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getCConstraint_Constraint() {
		return (EReference)cConstraintEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getCConstraint_Variables() {
		return (EReference)cConstraintEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCTwoConstraint() {
		return cTwoConstraintEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getCTwoConstraint_Constraints() {
		return (EReference)cTwoConstraintEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EDataType getConstraint() {
		return constraintEDataType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConstraintFactory getConstraintFactory() {
		return (ConstraintFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		cConstraintExprEClass = createEClass(CCONSTRAINT_EXPR);

		cIntCompareEClass = createEClass(CINT_COMPARE);
		createEReference(cIntCompareEClass, CINT_COMPARE__PARAMETERS);

		cEqEClass = createEClass(CEQ);

		cNeqEClass = createEClass(CNEQ);

		cLtEClass = createEClass(CLT);

		cLeqEClass = createEClass(CLEQ);

		cLogicConstraintEClass = createEClass(CLOGIC_CONSTRAINT);

		cAndEClass = createEClass(CAND);

		cOrEClass = createEClass(COR);

		cImpEClass = createEClass(CIMP);

		cNotEClass = createEClass(CNOT);

		cnConstraintEClass = createEClass(CN_CONSTRAINT);
		createEReference(cnConstraintEClass, CN_CONSTRAINT__CONSTRAINTS);

		cOneConstraintEClass = createEClass(CONE_CONSTRAINT);
		createEReference(cOneConstraintEClass, CONE_CONSTRAINT__CONSTRAINT);

		cConstraintEClass = createEClass(CCONSTRAINT);
		createEAttribute(cConstraintEClass, CCONSTRAINT__COMMENT);
		createEReference(cConstraintEClass, CCONSTRAINT__CONSTRAINT);
		createEReference(cConstraintEClass, CCONSTRAINT__VARIABLES);

		cTwoConstraintEClass = createEClass(CTWO_CONSTRAINT);
		createEReference(cTwoConstraintEClass, CTWO_CONSTRAINT__CONSTRAINTS);

		// Create data types
		constraintEDataType = createEDataType(CONSTRAINT);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		CommonPackage theCommonPackage = (CommonPackage)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI);
		ExpressionPackage theExpressionPackage = (ExpressionPackage)EPackage.Registry.INSTANCE.getEPackage(ExpressionPackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		cConstraintExprEClass.getESuperTypes().add(theCommonPackage.getCNode());
		cIntCompareEClass.getESuperTypes().add(this.getCConstraintExpr());
		cEqEClass.getESuperTypes().add(this.getCIntCompare());
		cNeqEClass.getESuperTypes().add(this.getCIntCompare());
		cLtEClass.getESuperTypes().add(this.getCIntCompare());
		cLeqEClass.getESuperTypes().add(this.getCIntCompare());
		cLogicConstraintEClass.getESuperTypes().add(this.getCConstraintExpr());
		cAndEClass.getESuperTypes().add(this.getCLogicConstraint());
		cAndEClass.getESuperTypes().add(this.getCNConstraint());
		cOrEClass.getESuperTypes().add(this.getCLogicConstraint());
		cOrEClass.getESuperTypes().add(this.getCNConstraint());
		cImpEClass.getESuperTypes().add(this.getCLogicConstraint());
		cImpEClass.getESuperTypes().add(this.getCTwoConstraint());
		cNotEClass.getESuperTypes().add(this.getCLogicConstraint());
		cNotEClass.getESuperTypes().add(this.getCOneConstraint());
		cnConstraintEClass.getESuperTypes().add(this.getCConstraintExpr());
		cOneConstraintEClass.getESuperTypes().add(this.getCConstraintExpr());
		cConstraintEClass.getESuperTypes().add(theCommonPackage.getCElement());
		cTwoConstraintEClass.getESuperTypes().add(this.getCConstraintExpr());

		// Initialize classes and features; add operations and parameters
		initEClass(cConstraintExprEClass, CConstraintExpr.class, "CConstraintExpr", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		addEOperation(cConstraintExprEClass, this.getConstraint(), "constraint", 1, 1, IS_UNIQUE, IS_ORDERED);

		initEClass(cIntCompareEClass, CIntCompare.class, "CIntCompare", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getCIntCompare_Parameters(), theExpressionPackage.getCIntExpr(), null, "parameters", null, 2, 2, CIntCompare.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(cEqEClass, CEq.class, "CEq", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(cNeqEClass, CNeq.class, "CNeq", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(cLtEClass, CLt.class, "CLt", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(cLeqEClass, CLeq.class, "CLeq", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(cLogicConstraintEClass, CLogicConstraint.class, "CLogicConstraint", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(cAndEClass, CAnd.class, "CAnd", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(cOrEClass, COr.class, "COr", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(cImpEClass, CImp.class, "CImp", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(cNotEClass, CNot.class, "CNot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(cnConstraintEClass, CNConstraint.class, "CNConstraint", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getCNConstraint_Constraints(), this.getCConstraintExpr(), null, "constraints", null, 0, -1, CNConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(cOneConstraintEClass, COneConstraint.class, "COneConstraint", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getCOneConstraint_Constraint(), this.getCConstraintExpr(), null, "constraint", null, 1, 1, COneConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(cConstraintEClass, CConstraint.class, "CConstraint", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getCConstraint_Comment(), ecorePackage.getEString(), "comment", null, 1, 1, CConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getCConstraint_Constraint(), this.getCConstraintExpr(), null, "constraint", null, 1, 1, CConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getCConstraint_Variables(), theExpressionPackage.getCIntVar(), theExpressionPackage.getCIntVar_Constraints(), "variables", null, 0, -1, CConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		addEOperation(cConstraintEClass, null, "initVariables", 1, 1, IS_UNIQUE, IS_ORDERED);

		initEClass(cTwoConstraintEClass, CTwoConstraint.class, "CTwoConstraint", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getCTwoConstraint_Constraints(), this.getCConstraintExpr(), null, "constraints", null, 2, 2, CTwoConstraint.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		// Initialize data types
		initEDataType(constraintEDataType, Constraint.class, "Constraint", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
	}

} //ConstraintPackageImpl
